﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using BitPortal.Models;
using BitPortal.Business;
using BitPortal.Utils;

namespace BitPortal
{
    public partial class Articles : Controls.BaseFrontendPage
    {
        protected void Page_Load(object sender, EventArgs e)
        {

        }

        public override void BindMetaData()
        {
            base.BindMetaData();
            ltrNavigation.Text = "";
            ArticleCategory ac = ArticleCategoryBLL.GetByID(Request.QueryString["ArticleCategoryID"].ToInt32TryParse());
            if (ac == null)
            {
                ltrNavigation.Text += "<li>" + Resources.BitResources.Article + "</li>";
                this.Title = Resources.BitResources.Article;
                return;
            }
            ltrNavigation.Text += "<li><a href=\"/Articles.aspx\" >" + Resources.BitResources.Article + "</a></li>";
            var parents = ac.GetParents();
            for (int i = parents.Count - 1; i >= 0; i--)
            {
                ltrNavigation.Text += " <li><a href=\"" + parents[i].GetSEOUrl() + "\" title=\"" + parents[i].Name + "\">" + parents[i].Name + "</a></li>";
            }
            ltrNavigation.Text += "<li>" + ac.Name + "</li>";
            this.Title = ac.Name;
            this.MetaDescription = ac.Meta.MetaDescription;
            this.MetaKeywords = ac.Meta.MetaKeyword;
        }
    }
}